import { ObjCreate } from "../../common/ObjCreate";
import { GTextFormat } from "../../../../common/GTextFormat";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GScrollPane } from "../../../../../com/mui/controls/GScrollPane";
import { ScrollPolicy } from "../../../../../fl/controls/ScrollPolicy";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { CareerUtil } from "../../common/util/CareerUtil";
import { ECareer } from "../../../../../Message/Public/ECareer";
import { SecondCareerConfig } from "../../../resource/SecondCareerConfig";
import { ECareerSecondTran } from "../../../../../Message/Public/ECareerSecondTran";
import { ItemConfig } from "../../../resource/ItemConfig";
import { EBind } from "../../../../../Message/Public/EBind";
import { EColor } from "../../../../../Message/Public/EColor";
import { ItemData } from "../../../resource/info/ItemData";
import { BaseItemNormal } from "../../common/item/BaseItemNormal";
import { ItemsUtil } from "../../shortcuts/item/ItemsUtil";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
type int = number;
//class RuneMapPanel
    
    export  class RuneMapPanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.initUI();
            this.initData();
            return;
        }

        /* internal  */initUI(): void
        {
            this._bg = ObjCreate.createBg(0, 0, 370, 430, this);
            this._tf1 = new GTextFormat(null, 15, 16776960, null, null, null, null, null, flash.text.TextFormatAlign.CENTER);
            this._tf2 = new GTextFormat(null, 12, 16776960, null, null, null, null, null, flash.text.TextFormatAlign.CENTER);
            this._bodySp = new Object /* flash.display.Sprite */();
            this._nameW = ObjCreate.createGTextField("", 0, 0, 90, 20, this._bodySp, this._tf1);
            this._nameY = ObjCreate.createGTextField("", 90, 0, 90, 20, this._bodySp, this._tf1);
            this._nameF = ObjCreate.createGTextField("", 180, 0, 90, 20, this._bodySp, this._tf1);
            this._nameT = ObjCreate.createGTextField("", 270, 0, 90, 20, this._bodySp, this._tf1);
            ObjCreate.createBg(0, 25, 370, 2, this._bodySp, ImagesConst.SplitLine);
            this._contentPane = new GScrollPane();
            this._contentPane.styleName = "GScrollPane";
            this._contentPane.horizontalScrollPolicy = ScrollPolicy.OFF;
            this._contentPane.verticalScrollPolicy = ScrollPolicy.AUTO;
            this._contentPane.width = 370;
            this._contentPane.height = 420;
            this._contentPane.source = this._bodySp;
            this._contentPane.move(0, 5);
            this.addChild(this._contentPane);
            return;
        }

        /* internal  */initData(): void
        {
            var loc6=null;
            var loc7=null;
            var loc9=0;
            var loc10=null;
            var loc11=0;
            var loc12=null;
            this._nameW.htmlText = HTMLUtil.addColor(CareerUtil.getCareerName(ECareer._ECareerWarriorD), "#FFFF00");
            this._nameY.htmlText = HTMLUtil.addColor(CareerUtil.getCareerName(ECareer._ECareerStabber), "#FFFF00");
            this._nameF.htmlText = HTMLUtil.addColor(CareerUtil.getCareerName(ECareer._ECareerIceMage), "#FFFF00");
            this._nameT.htmlText = HTMLUtil.addColor(CareerUtil.getCareerName(ECareer._ECareerPriest), "#FFFF00");
            var loc1="";
            var loc2="";
            var loc3="";
            var loc4="";
            var loc5=SecondCareerConfig.instance.careerMapF;
            var loc8=[];
            var loc13=0;
            var loc14=loc5;
            for(loc7 of loc14) 
            {
                if (loc7.category != ECareerSecondTran._ECareerSecondRune) 
                {
                    continue;
                }
                loc8.push(loc7);
            }
            loc8.sortOn("codeW");
            loc12 = new Map<any, any> /* flash.utils.Dictionary */();
            loc13 = 0;
            loc14 = loc8;
            for(loc7 of loc14) 
            {
                loc11 = (loc10 = ItemConfig.instance.getInfoByCode(loc7.codeW)).item.bind != EBind._EBindYes ? loc10.item.code : loc10.item.codeUnbind;
                if (!(loc10 && loc10.item.color == EColor._EColorOrange && loc11 > 0 && loc12[loc11] == null)) 
                {
                    continue;
                }
                loc12[loc11] = loc11;
                this.createRuneItem(loc7.codeW, 0, loc9 * 60 + 34);
                this.createRuneItem(loc7.codeY, 90, loc9 * 60 + 34);
                this.createRuneItem(loc7.codeF, 180, loc9 * 60 + 34);
                this.createRuneItem(loc7.codeT, 270, loc9 * 60 + 34);
                ++loc9;
            }
            this._contentPane.update();
            return;
        }

        /* internal  */createRuneItem(arg1: int, arg2: int, arg3: int): void
        {
            var loc1=new ItemData(arg1);
            var loc2;
            (loc2 = new BaseItemNormal()).isDragAble = false;
            loc2.isDropAble = false;
            loc2.setSize(32, 32);
            loc2.x = arg2 + 29;
            loc2.y = arg3;
            loc2.itemData = loc1;
            this._bodySp.addChild(loc2);
            var loc3;
            (loc3 = ObjCreate.createGTextField("", arg2, arg3 + 35, 90, 20, this._bodySp, this._tf2)).htmlText = ItemsUtil.getItemName(loc1);
            return;
        }

        public setHight(arg1: int): void
        {
            this._bg.height = arg1;
            this._contentPane.height = arg1 - 10;
            this._contentPane.update();
            return;
        }

        /* internal */ /* var */_bg: ScaleBitmap;

        /* internal */ /* var */_bodySp: Object /* flash.display.Sprite */;

        /* internal */ /* var */_nameW: GTextFiled;

        /* internal */ /* var */_nameY: GTextFiled;

        /* internal */ /* var */_nameF: GTextFiled;

        /* internal */ /* var */_nameT: GTextFiled;

        /* internal */ /* var */_tf1: GTextFormat;

        /* internal */ /* var */_tf2: GTextFormat;

        /* internal */ /* var */_contentPane: GScrollPane;
    }
